<!DOCTYPE html>
<html lang="ru">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>9 практическая</title>
	<link rel="stylesheet" href="../css/style.css">
	<link rel="shortcut icon" href="https://media04.lokalkompass.de/article/2017/07/25/3/9561933_XXL.jpg">
</head>
<body>
	<div class="header-wraper">
		<div class="header">
			<a href="/" class="logo-link">
				<img src="../css/s2.png" alt="logo" class="logo-img">
				<p class="logo-text">На главную</p>
			</a>
		</div>
	</div>
	<div class="content-wraper">
		<div class="content">
			<form action="#" method="GET">
				<span class="travel">Выберите страну:</span>
				<select name="country" id="country">
					<option value="Turkey">Турция</option>
					<option value="Italy">Италия</option>
					<option value="Egypt">Египет</option>
				</select><br>
				<span class="travel">Введите количество дней отдыха:</span>
				<input type="text" name="NoD" class="input-text"><br>
				<span class="travel">У вас есть скидка?</span>
				<input type="checkbox" name="discount" value="1" class="input-checbox"><br>
				<button class="butsub">Расчитать стоимость</button>
			</form>
			<?php
				if ($_GET){
					$country = $_GET['country'];
					$NoD = $_GET['NoD'];
					$discount = $_GET['discount'];
					switch ($country) {
						case 'Italy':
							$contcoef = 0.12;
							break;
						
						case 'Egypt':
							$contcoef = 0.1;
							break;

						default:
							$contcoef = 0;
							break;
					}
					if (is_numeric($NoD)){
						$cost = intval($NoD) * 400;
						$cost = $cost * $contcoef + $cost;

						if ($discount == 1){
							$$cost = $cost - $cost * 0.5;
						}
					}
					echo "<span>Стоимость поездки: $cost</span>";
				}
			?>
		</div>
	</div>
</body>
</html>
